/*
* SyncLoopHook 只要监听函数不返回undefined，就循环执行该监听函数
*/
const { SyncLoopHook } = require('../real-tapable');
// const { SyncLoopHook } = require('tapable');

class Test {
    hooks = {
        arch: new SyncLoopHook(['arg1', 'arg2'])
    }
}
let index = 0;
const test = new Test();
test.hooks.arch.tap('yxfan', (say) => {
    console.log(say, ': yxfan', index);    
  
    return ++index === 3 ? undefined : 'wait a moment'
})
test.hooks.arch.tap('cheney', (say) => {
    console.log(say, ': cheney');
})

test.hooks.arch.call('hello')